importClass('rapi.rbase.RLabel');

function RToolTip(left,top,text,delay){
	this.left=left;
	this.top=top;
	this.text=text;
	if(delay>0){
		this.delay=delay;
	}else{
		this.delay=10;
	} 
	
	this.counter=0;
	this.label=new RLabel(left,top,text);
	this.label.hide();	
	this.style=this.label.style;
	
	this.label.get().align='center';
	this.style.border='1px solid #fac194';
	this.style.backgroundColor='#fff9f4';
	
	this.toString=function(){
		return 'RToolTip';
	}
	this.get=function(){
		return this.label.get();
	}
	
	this.show=function(){
		this.label.show();
		this.delayHide();
	}
	
	this.delayHide=function(){
		if(this.counter<this.delay){
			setRTimeout(this,this.delayHide,1000)
			this.counter++;
		}else{
			this.hide();
			this.counter=0;
		}
	}
	
	this.hide=function(){ 
		this.label.hide();
	}
	
	this.setText=function(text){
		this.text=text;
		this.label.setText(text);
	}
	
	this.getText=function(){
		return this.text;
	}
	
	this.isVisible=function(){
		if(this.label.style.visibility=='hidden'){
			return false;
		}else{
			return true;
		}
	}
	
	this.setLeftTop=function(left,top)
	{
	    this.style.left=left;
	    this.style.top=top;
	}
}